<?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');?>
<!-- click tooltip -->
<div id="toannh-tooltip" >
	<p class="myclear">
		<img alt="" id="toannh-tooltip-arrow" src="/images/toannhtooltiparrow.gif" />
	</p>
	<div id="toannh-tooltip-inner" >
		<p id="toannh-tooltip-title"></p>
		<div id="toannh-tooltip-body" class="myclear"></div>
		<p class="ok-box myclear">
			<img alt="" src="/images/okbtn.gif" onclick="removeToannh_Tooltip();" />
		</p>
	</div>
</div>
<!-- hover tooltip -->
<div id="toannh-tooltip2">
	<div id="toannh-tooltip-inner2" >
		<p id="toannh-tooltip-title2">Destination URL</p>
		<div id="toannh-tooltip-body2" class="myclear"></div>
	</div>
	<p class="myclear">
		<img alt="" id="toannh-tooltip-arrow-down" src="/images/toannhtooltiparrowdown.gif" />
	</p>
</div>
<!--domain tooltip -->
<div class="ttip-ad-preview" id="tooltip2">
    <p class="myclear">
		<img alt="" class="ttip-ad-preview-arrow" src="/images/toannhtooltiparrow.gif" />
	</p>
	<div class="trung-ttip-ad-preview-inner">
		<div class="ttip-ad-preview-inner-pad" id="content2">
            <div style="width: 300px;height:246px;text-align: center;">
				<img src="/images/ajax-loader.gif" style="margin-top: 80px;"/>
            </div>
		</div>
		<p class="ttip-adprv-btn-box myclear">
			<a onclick="domain_tooltip_preview_remove();" class="ttip-adprv-edit">
				<?php echo $banner_lang['cancelTooltip'];?>
			</a>
		</p>
	</div>
</div>
<!-- Preview tooltip -->
<div class="ttip-ad-preview" id="tooltip">
    <p class="myclear">
		<img alt="" class="ttip-ad-preview-arrow" src="/images/toannhtooltiparrow.gif" />
	</p>
	<div class="ttip-ad-preview-inner">
		<div class="ttip-ad-preview-inner-pad" id="content">
            <div style="width: 496px;height:273px;text-align: center;">
				<img src="images/ajax-loader.gif" style="margin-top: 80px;"/>
            </div>
		</div>
		<p class="ttip-adprv-btn-box myclear">
			<a class="btn marright10" id="preview-tooltip">
				<span>
                    <?php echo $banner_lang['editTooltip'];?>
                </span>
			</a>
			
            <a class="btn marright10" id="copyad-tooltip">
                <span>
				    <?php echo $banner_lang['copyad'];?>
                </span>
			</a>
            
            <a class="btn marright10" id="deletead-tooltip">
                <span>
				    <?php echo $banner_lang['temp_delete'];?>
                </span>
			</a>
            
			<a onclick="tooltip_preview_remove1()" class="ttip-adprv-cancel">
				<?php echo $banner_lang['cancelTooltip'];?>
			</a>
            
		</p>
	</div>
</div>
<!-- colum right -->
<div class="middle myclear">
	<div class="pad10">
		
		<h2 class="marbottom10 martop20">
			Tất cả banner 
		</h2>
        <br />
        search <input class="lsearch-input text-999" id="lsearch-input" type="text" value="gdhfg" onfocus="removeGrayText();" onkeydown="searchKeyPress(event);"/>
            <img alt="" class="lsearch-btn" src="/images/lsearchbtn.gif" id="lsearch-btn" onclick="ajax_search();"/>
		<div class="dashboard-box myclear">
							
			<table class="mbd-timebox martop20" cellpadding="0" cellspacing="0" border="0">	
				<tr>
					<td class="padright10 ver-middle">
						<input class="input-time" type="text" id="date" value="<?php echo date('d/m/Y',strtotime($fromdate))?> <?php echo $banner_lang['to'];?> <?php echo date('d/m/Y',strtotime($todate))?>" />
					</td>
					
					<td class="padright10 ver-middle">
						<select class="payment-by-month" id="status">
                            <option value="123" <?php echo $status==123 ? 'selected="selected"':'' ;?>><?php echo $banner_lang['all'];?></option>
                            <option value="-1" <?php echo $status==-1 ? 'selected="selected"':'' ;?>><?php echo $banner_lang['completed'];?></option>
							<option value="1" <?php echo $status==1 ? 'selected="selected"':'' ;?>><?php echo $banner_lang['running'];?></option>
                            <option value="2" <?php echo $status==2 ? 'selected="selected"':'' ;?>><?php echo $banner_lang['paused'];?></option>
                            <option value="3" <?php echo $status==3 ? 'selected="selected"':'' ;?>><?php echo $banner_lang['waiting'];?></option>
                            <option value="4" <?php echo $status==4 ? 'selected="selected"':'' ;?>><?php echo $banner_lang['problem'];?></option>
                            <option value="5" <?php echo $status==5 ? 'selected="selected"':'';?>><?php echo $banner_lang['outofmoney'];?></option>
                            <option value="6" <?php echo $status==6 ? 'selected="selected"':'';?>><?php echo $banner_lang['het_ngan_sach'];?></option>
                            <option value="7" <?php echo $status==7 ? 'selected="selected"':'';?>><?php echo $banner_lang['dealed'];?></option>
                            <option value="8" <?php echo $status==8 ? 'selected="selected"':'';?>><?php echo $banner_lang['waittorun'];?></option>
						</select>
					</td>
					
					<td class="padright10 ver-middle">
						<select class="payment-by-month" id="filterGroup">
							<option value="-1">Tất cả</option>
							<?php
							foreach($lstGroup as $gr)
							{
							?>
								<option <?php echo $groupid == $gr['groupid'] ? 'selected="selected"' : '';?> value="<?php echo $gr['groupid']; ?>"><?php echo $gr['groupname']; ?></option>
							<?php
							}
							?>
						</select>
					</td>
					
					<td class="padright10 ver-middle">
						<input type="text" name="txtUserFilter" id="txtUserFilter" class="superblyTagfield" allowNewTags="false"  number="5000" readonly="readonly" preset="<?php echo $strUserId; ?>" />
					</td>
					
                    <td class="ver-middle">
                        <input type="button" class="btn" value="Xem" onclick="adBannerFilter('<?php echo site_url('banner'); ?>');" />
                    </td>
				</tr>
			</table>
			<div id="campaigndiv">
				<table class="tbl-list" width="100%" cellpadding="0" cellspacing="0" border="1" id="table">
	                <thead>
						<tr>
							<th class="td-label bold text-center ver-middle" width="50" style="padding: 5px 0;">
								<span><?php echo $banner_lang['#'];?></span>
							</th>
							
							<th class="td-label bold text-center ver-middle" width="80" style="padding: 5px 0;">
								<span><?php echo $banner_lang['preview'];?></span>
							</th>
							
							<th class="td-label bold text-center ver-middle" width="155" style="padding: 5px 0;">
	                            <p class="ver-middle" style="height:33px;line-height: 33px;"><?php echo $banner_lang['ad'];?></p>
							</th>
							
							<th class="td-label bold text-center ver-middle" width="43" style="padding: 5px 0;">
								<span><?php echo $banner_lang['status'];?></span>
							</th>
							
							<th class="td-label bold text-center ver-middle" width="49" style="padding: 5px 0;">
								<p class="ver-middle" style="height:33px;line-height: 33px;">Click</p>
							</th>
							
							<th class="td-label bold text-center ver-middle" width="76" style="padding: 5px 0;">
								<p class="ver-middle" style="height:33px;line-height: 33px;">Impressions</p>
							</th>
							
							<th class="td-label bold text-center ver-middle" width="85" style="padding: 5px 0;">
								<p class="ver-middle" style="height:33px;line-height: 33px;">Unique Visitor</p>
							</th>
							
							<th class="td-label bold text-center ver-middle" width="55" style="padding: 5px 0;">
								<p class="ver-middle" style="height:33px;line-height: 33px;">CTR %</p>
							</th>
							
							<th class="td-label bold text-center ver-middle" width="201" style="padding: 5px 0;">
								Tăng click trong ngày <span class="cursor-pointer let-space-2 text-999" onmouseover="toannh_tooltip2(this, '<?php echo $banner_lang['tooltip_title_click']?>', '<?php echo $banner_lang['tooltip_content_click']?>');" onmouseout="removeToannh_Tooltip2();">[<b>?</b>]</span>
							</th>
							
							<th class="td-label bold text-center ver-middle" width="150" style="padding: 5px 0;">
								Username
							</th>
						</tr>
	                </thead>
	                <tbody>
						<?php 
						$index=1+($cPage-1)*$numShowItem;
	                    foreach($info as $if)
	                    {
	                    ?>
						<tr>
							<td class="ver-middle pad5 text-center">
								<?php echo $index;?>
							</td>
							
							<td class="ver-middle pad5 text-center">
	                            
								<p class="db-list-cl-img">
	                                <a href="javascript:void(0);" onclick="ajax_tooltip(<?php echo $if['bannerid']?>,this,<?php echo $index;?>,<?php echo $if['status'];?>); return false;">
	      						        <img alt="" src="<?php echo $if['filepath'];?>" width="50"/>
	                                </a>
								</p>
							</td>
							
							<td class="ver-middle pad5">
								<div class="db-list-cl-banner">
									<p >
	                                    <a href="<?php echo site_url('bannerdetail/index?bannerid='.$if['bannerid'].'&fromdate='.date('Y-m-d',strtotime($fromdate)).'&todate='.date('Y-m-d',strtotime($todate)))?>">
										   <?php echo $if['bannername'];?>
	                                    </a>
									</p>
									<p class="text-999">
	                                    <a style="color: gray;" href="<?php echo site_url('campaigndetail/index?campaignid='.$if['campaignid'].'&fromdate='.date('Y-m-d',strtotime($fromdate)).'&todate='.date('Y-m-d',strtotime($todate)))?>">
										   <?php echo $if['campaignname'];?>
	                                    </a>
									</p>
								</div>
							</td>
							
							<td class="ver-middle pad5 text-center">
								<p class="db-list-cl-status edit">
	                                <input type="hidden" value="<?php echo site_url('banner/edit') . '?bannerid='. $if['bannerid'].'&type=1';?>" class="hddEditLink"/>
	                                <?php //echo $if['status'];
                                    if($if['outofstore']==1)
                                        echo '<img class="cursor-pointer" alt="" src="/images/dealed.png"/>';
	                                elseif($if['status']==-1)
	                                    echo '<img class="cursor-pointer" alt="" src="/images/imgok.gif" />';
                                    elseif($if['status']==0)
                                        echo '<img class="cursor-pointer" alt="" src="/images/temp_deleted.gif"/>';
	                                elseif($if['status']==1)
	                                    echo '<img class="cursor-pointer" alt="" src="/images/imgrun.gif" />';
	                                elseif($if['status']==2)
	                                    echo '<img class="cursor-pointer" alt="" src="/images/imgpause.gif" />';
	                                elseif($if['status']==3)
	                                    echo '<img class="cursor-pointer" alt="" src="/images/imgwait.png" />';
	                                elseif($if['status']==4)
	                                    echo '<img class="cursor-pointer" alt="" src="/images/imgproblem.png" />';
                                    elseif($if['status']==5)
                                        echo '<img class="cursor-pointer" alt="" src="/images/imgout-of-money.png"/>';
                                    elseif($if['status']==6)
                                        echo '<img class="cursor-pointer" alt="" src="/images/het_ngan_sach.gif"/>';
                                    elseif($if['status']==8)
                                        echo '<img class="cursor-pointer" alt="" src="/images/chochay.gif"/>';
                                    else
                                        echo $if['status'];
	                                ?>
								</p>
							</td>
							
							<td class="ver-middle text-right pad5">
								<div class="db-list-cl-click">
									<p>
										<a <?php echo ($if['clicks']!= 'N/A') ? 'onclick="ajax_tooltip2('.$if['bannerid'].',this,0)"' : '' ;?> ><?php echo $if['clicks'];?></a>
									</p>
								</div>
							</td>
							
							<td class="ver-middle text-right pad5">
								<div class="db-list-cl-imp">
									<p>
										<a <?php echo ($if['clicks']!= 'N/A') ? 'onclick="ajax_tooltip2('.$if['bannerid'].',this,1)"' : '' ;?> ><?php echo $if['impressions'];?></a>
									</p>
								</div>
							</td>
							
							<td class="ver-middle text-right pad5">
								<div class="db-list-cl-uv">
									<p>
										<?php echo $if['uviews'];?>
									</p>
								</div>
							</td>
							
							<td class="ver-middle text-right pad5">
								<div class="db-list-cl-ctr">
									<p>
										<?php echo $if['CTR'];?>
									</p>
	                                <!--
									<p class="myclear padtop5">
										<img class="block" alt="" src="images/arrowdown.gif" />
									</p>
	                                -->
								</div>
	                            <input type="hidden" class="abcdef" value="<?php echo $if['bannerid']; ?>" />
							</td>
							
							<td class="ver-middle pad5">
								<div class="slider" id="slider-<?php echo $if['bannerid'];?>">
	                            	<input class="slider-input" id="slider-input-<?php echo $if['bannerid'];?>"/>
	                            </div>
	                            <div class="marleft5" id="h-value<?php echo $if['bannerid'];?>">
	                            <?php //echo $if['speed'];
	                                if($if['speed']==10)
	                                {
	                                    echo 'Chạy với tốc độ mặc định';
	                                }elseif(($if['speed'] < 10))
	                                {
	                                    $speed= 100-$if['speed']*10;
	                                    echo 'Chạy chậm hơn '.$speed.'% so với mặc định';
	                                }else{
	                                    $speed= $if['speed']*10-100;
	                                    echo 'Chạy nhanh hơn '.$speed.'% so với mặc định';
	                                }
	                            ?>
	                            </div>
	                            <script type="text/javascript">
	                                var testfnc<?php echo $if['bannerid'];?> = function(val)
	                                {
	                                    var strURL="<?php echo site_url('banner/editSpeed?val=');?>"+val+"&type=3&bannerid=<?php echo $if['bannerid'];?>&default=<?php echo $if['speed'];?>";
	                                    getAjax(strURL,"",'');
	                                    //console.info('slider<?php echo $if['bannerid'];?> :'+val);
	                                };
	                                var s<?php echo $if['bannerid'];?> = new Slider(document.getElementById("slider-<?php echo $if['bannerid'];?>"),document.getElementById("slider-input-<?php echo $if['bannerid'];?>"), 'horizontal', testfnc<?php echo $if['bannerid'];?>,<?php echo $if['speed'];?>);
	                                s<?php echo $if['bannerid'];?>.onchange = function () 
	                                {
	                                    var temp<?php echo $if['bannerid'];?> = s<?php echo $if['bannerid'];?>.getValue()
	                                    if(temp<?php echo $if['bannerid'];?> > 10)
	                                    {
	                                        $("#h-value<?php echo $if['bannerid'];?>").html('Nhanh hơn '+(temp<?php echo $if['bannerid'];?>*10-100)+'% so với mặc định.');
	                                    }else if(temp<?php echo $if['bannerid'];?> < 10)
	                                    {
	                                        $("#h-value<?php echo $if['bannerid'];?>").html('Chậm hơn '+(100-(temp<?php echo $if['bannerid'];?>*10))+'% so với mặc định.');
	                                    }else{
	                                        $("#h-value<?php echo $if['bannerid'];?>").html('Chạy với tốc độ hiện tại.');
	                                    }
	                                };
	                            </script>
							</td>
							<td class="pad5 text-center">
								<?php echo $if['username'];?>
							</td>
						</tr>
						<?php
	                    $index++;
	                    }
	                    ?>
	                </tbody>
				</table>
				
				<table class="tbl-list brv-paging martop10 float-right" border="1" cellpadding="0" cellspacing="0">
					<tr>
						<td class="brv-paging-name">
							<?php echo $banner_lang['page'];?> <?php echo $cPage; ?>/<?php echo $pCount; ?>
						</td>
						
						<td class="brv-paging-pre-next" width="48">
							<img class="brv-img-pre" alt="previous" src="/images/imgpre.gif" <?php echo ($cPage > 1) ? 'onclick="adBannerPaging(\'' . site_url("banner/?fromdate=$fdateUrl&todate=$tdateUrl&status=$status&cpage=" . ($cPage - 1) . "&numitem=$numShowItem&groupid=$groupid&user=$strUserId" ) . '\');"' : ''; ?>/>
							<img class="brv-img-next" alt="next" src="/images/imgnext.gif" <?php echo ($cPage < $pCount) ? 'onclick="adBannerPaging(\'' . site_url("banner/?fromdate=$fdateUrl&todate=$tdateUrl&status=$status&cpage=" . ($cPage + 1) . "&numitem=$numShowItem&groupid=$groupid&user=$strUserId" ) . '\');"' : ''; ?> />
						</td>
						
						<td class="brv-paging-num-item">
							<select id="slcNumItem" onchange="adBannerPaging('<?php echo site_url("banner/?fromdate=$fdateUrl&todate=$tdateUrl&status=$status&cpage=1&groupid=$groupid&user=$strUserId"); ?>' + '&numitem=' + this.value);" >
								<option value="10" <?php echo ($numShowItem == 10) ? 'selected="selected"' : '';?> >10</option>
								<option value="20" <?php echo ($numShowItem == 20) ? 'selected="selected"' : '';?> >20</option>
								<option value="50" <?php echo ($numShowItem == 50) ? 'selected="selected"' : '';?>>50</option>
							</select>
						</td>
					</tr>
				</table>
				
			</div>	
		</div>
		<br /><br /><br /><br /><br />
		<p class="text-right pad10">
			<img id="top" class="cursor-pointer" alt="" src="images/backtotop.gif" onclick="window.scrollTo(0,0); return false;"/>
		</p>
	</div> 
</div>
<script type="text/javascript">
    function removeGrayText()
    {
        $('#lsearch-input').removeClass("text-999");
        $('#lsearch-input').val('');
    }
    function searchKeyPress(e)
    {
        var key;
        if(window.event)
          key = window.event.keyCode;     //IE
        else
          key = e.which;     //firefox
        
        if(key == 13)
            $('#lsearch-btn').click();
        else
          return true;
    }
    function ajax_search()
    {
        var name=$('#lsearch-input').val();
        url="<?php echo site_url('banner/search?name=')?>"+name;
        window.location=url;
    }
	function adBannerFilter(url)
    {
    	var strDate = $('#date').val();
    	var arrDate = strDate.split(' ');
    	var arrStartDate = $.trim(arrDate[0]).split('/');
    	var strStartDate = arrStartDate[2] + '-' + arrStartDate[1] + '-' + arrStartDate[0];
    	
    	var arrEndDate = $.trim(arrDate[2]).split('/');
    	var strEndDate = arrEndDate[2] + '-' + arrEndDate[1] + '-' + arrEndDate[0];
    	arrDate = null;
    	arrStartDate = null;
    	arrEndDate = null;
    	
    	var status = $('#status').val();
    	var group = $('#filterGroup').val();
    	var user = $('#txtUserFilter').val();
    	var numitem = $('#slcNumItem').val();
    	
    	window.location = url + '/?fromdate=' + strStartDate + '&todate=' + strEndDate + '&status=' + status + '&cpage=1' + '&numitem=' + numitem + '&group=' + group + '&user=' + user;
    }
    
	function ajax_tooltip(val,e,index,status)
	{
	    if(status== -1)
	    {
	        $('#preview-tooltip').hide();
	    }
	    index-=1;
	    var strURL="<?php echo site_url('banner/load_tooltip?bannerid=');?>"+val+"&index="+index+"&status="+status;
	    var strId= '#tooltip';
	    var strId2='#content';
	    tooltip_preview (e,strId);
	    $('#preview-tooltip').attr('href','<?php echo site_url('../home/editAd')?>/'+val);
	    var success = function(data)
	    {
	        $(strId2).html(data);
	        tooltip_preview (e,strId);
	        $('#preview-tooltip').attr('href','<?php echo site_url('../home/editAd')?>/'+val);
            $('#copyad-tooltip').attr('href','<?php echo site_url('../home/copyad')?>/'+val);
            $('#deletead-tooltip').attr('href','<?php echo site_url('banner/deleteAd')?>/'+val);
	    };
	    getAjax(strURL,"",'', '', '', false, success);
	}
	function ajax_tooltip2(val,e,typedatata)
	{
	    var temp = $('#date').val();
	    var status = $('#status').val();
		temp=temp.split(' <?php echo $banner_lang['to']?> ');
	 	var fromdate=temp[0];
	 	var todate=temp[1];
	 	fromdate=fromdate.replace(/\//g,'-');
	  	todate=todate.replace(/\//g,'-');
	    
	    var strURL="<?php echo site_url('banner/domain_report_tooltip?bannerid=');?>"+val+"&typeid=1&typedatata="+typedatata+"&fromdate="+fromdate+"&todate="+todate;
	    var strId= '#tooltip2';
	    var strId2='#content2';
	    tooltip_preview (e,strId);
	    var success = function(data)
	    {
	        $(strId2).html(data);
	        tooltip_preview (e,strId);
	    };
	    getAjax(strURL,"",'', '', '', false, success);
	}
	
	function adBannerPaging(url)
	{
		window.location = url;
		return;
	}
	
    $('#date').DatePicker({
        format: 'd/m/Y',
        date: ['<?php echo date('d/m/Y',strtotime($fromdate));?>','<?php echo date('d/m/Y',strtotime($todate));?>'],
        current: '<?php echo date('d/m/Y');?>',
        calendars: 2,
        mode: 'range',
        starts: 1, 
        onChange: function(formated, dates) 
        {
            $('#loading').show();
            $('#date').val(formated.join(' <?php echo $banner_lang['to'];?> '));
            $('#date').DatePickerHide();
        }
    });
    function ajax_status()
    {
        var status = $('#status').val();
        var arrTime = $('#date').val().toString().split(' <?php echo $banner_lang['to'];?> ');
        var fromdate = arrTime[0];
        var todate = arrTime[1];
        var strReplace="/";
        fromdate=fromdate.replace(/\//g,'-');
        todate=todate.replace(/\//g,'-');
        var strURL="<?php echo site_url('banner/filter?status=');?>"+status+"&fromdate="+fromdate+"&todate="+todate;
        var success = function(data)
        {
        	$('#campaigndiv').html(data);
        	$('#loading').hide();
        };
    	$('#loading').show();
        getAjax(strURL,"",'', '', '', false, success);
    }
 	<?php
 	if(!empty($info))
 	{
 	?>
		$(function() {        
    	  $(".edit").editable('',{ 
    	    data   : "{'2':'<?php echo $banner_lang['paused'];?>', '1':'<?php echo $banner_lang['run'];?>','3':'<?php echo $banner_lang['temp_delete'];?>','selected':'"  + $('#status').val() + "'}",
    	    type:"select",
    	    submit : 'OK',
    	    indicator : 'Wait...',
    	    id : 'hk',
    	    name : 'ns',
            typeEdit:true,
    	    css : 'inherit',
    	    cssclass : "editable",
    	    onblur    : "cancel"
    	  });  
    	});
	<?php
	}
	?>
	
	$(document).ready( function() 
    {
    	// init city location tag  suggestion
		$('.superblyTagfield').css('display', 'none');		
		var allowNewTags = false;
		var showTagsNumber = 1000;
		var preset = new Array();
		var url = '/admin/campaign/get_suggest_user';
		if($('#txtUserFilter').attr('allowNewTags') == 'false'){
			allowNewTags = false;
		}
    	if($('#txtUserFilter').attr('number') != null){
			showTagsNumber = $('#txtUserFilter').attr('number');
		}
				
		if($('#txtUserFilter').attr('preset') != null){
			preset = $('#txtUserFilter').attr('preset').split(',');
		}
		
		var fiterUserSuggestCallBack = function()
		{
						
		};
		
		superblyTagField($('#txtUserFilter'), url, preset, allowNewTags, showTagsNumber, '/images/ajaxLoading.gif', false, fiterUserSuggestCallBack, fiterUserSuggestCallBack, 'Gõ username để lựa chọn', '', '268');
		
		<?php
	   	foreach($lstUser as $user)
	   	{
		?>
			filterUserAddUser('#txtUserFilter', '<?php echo $user['username']; ?>', '<?php echo $user['user_id']; ?>', 'Gõ username để lựa chọn');
		<?php
	   	}
	    ?>
   	});
   	
   	function tooltip_preview_remove1()
    {
        tooltip_preview_remove('.ttip-ad-preview');
        $('#content').html('<div style="width: 496px;height:273px;text-align: center;"><img src="/images/ajax-loader.gif" style="margin-top: 80px;"/></div>');
    }
    function domain_tooltip_preview_remove()
    {
        tooltip_preview_remove('.ttip-ad-preview');
        $('#content2').html('<div style="width: 300px;height:246px;text-align: center;"><img src="/images/ajax-loader.gif" style="margin-top: 80px;"/></div>');
    }
    
    function filterUserAddUser(tagid, name, catid, strInputDefault)
    {
    	strInputDefault = (typeof(strInputDefault) === 'undefined' || strInputDefault === '') ? '' : strInputDefault;
		$(tagid).parent('.superblyTagInputItem').before("<li class='superblyTagItem'><span>" + name + "</span><a><img alt='' src='/images/x.gif' /></a><input type='hidden' class='superblyTagItemHddId' value='" + catid + "' /></li>");
		
		var val = $(tagid).val();
		if(val == '')
		{
			$(tagid).val(catid);	
		}
		else
		{
			$(tagid).val($(tagid).val() + ',' + catid);	
		}
		
		var new_index = $(tagid).parent('.superblyTagInputItem').parent('.superblyTagItems').children('.superblyTagItem').size()-1;	
		$($(tagid).parent('.superblyTagInputItem').parent('.superblyTagItems').children('.superblyTagItem')[new_index]).children('a').click(function(e){
			//var value = $($(this).parent('.superblyTagItem').children('span')[0]).text();
			var value = $($(this).parent('.superblyTagItem').children('.superblyTagItemHddId')).val();
			removeSuggestCat(value, tagid, strInputDefault);
		});
    }		
</script>